﻿
using CNav.Domain;
using FluentValidation;

namespace CNav.Business.Validation
{
    public class BusinessValidation : AbstractValidator<Domain.Business>
    {
        public BusinessValidation()
        {
            RuleFor(b => b.BusinessName).NotEmpty().Length(4, 50).WithMessage("Business name must be atleast 4 character long.");
            RuleFor(b => b.Email).EmailAddress().WithMessage("Please specify a email address.");
            RuleFor(b => b.AddressID).NotEmpty().WithMessage("Please provide valid business address");
            RuleFor(b => b.PhoneNumber).Must(ValidatorUtils.IsPhone).WithMessage("Please specify a valid phone number.");

            RuleFor(b => b.Address).SetValidator(new AddressValidation());
        }
    }
}
